package yieldCurve;
public class Cash extends Instrument {
	int toDay = 0;
	int toMonth = 0;

	/** Class constructor
	 * 
	 * @param subType e.g. ON, TN, 3W
	 * @param marketRate market rate of given instrument
	 */
	public Cash(String subType, double marketRate) {
		super(subType, marketRate);
		if (subType.equalsIgnoreCase("ON")) {
			toDay = 1;
		} else if (subType.equalsIgnoreCase("TN")) {
			toDay = 2;
		} else if (subType.contains("W") || subType.contains("w")) {
			int wPos = subType.indexOf("W");
			toDay = 7 * Integer.parseInt(subType.substring(0, wPos));
		} else if (subType.contains("M") || subType.contains("m")) {
			int mPos = subType.indexOf("M");
			toMonth = Integer.parseInt(subType.substring(0, mPos));
		}
	}
	
	public int getToDay() {
		return toDay;
	}
	
	public int getToMonth() {
		return toMonth;
	}

}